<template>
	<view class="page">
		<view class="searchBox">
			<view class="inputBox">
				<view class="inputRow" style="" >
					<view class="label">
						{{language.veriRegistration.label1}}:
					</view>
					<view  class="val" >
						{{detailObj.attDate}}
						<!-- <u-input v-model="params.personName" placeholder="请输入姓名"></u-input> -->
					</view>
				</view>
				<view class="inputRow" style="" >
					<view class="label">
						{{language.veriRegistration.label2}}:
					</view>
					<view  class="val" >
						{{detailObj.deptId_dictText}}
						<!-- <u-input v-model="params.personName" placeholder="请输入姓名"></u-input> -->
					</view>
				</view>
				<view class="inputRow" style="" >
					<view class="label">
						{{language.veriRegistration.label3}}:
					</view>
					<view  class="val" >
						{{detailObj.masterName ? detailObj.masterName : ''}}
						<view class="text">
							{{detailObj.masterPhone ? detailObj.masterPhone : ''}}
						</view>
						<view class="icon">
							<u-icon name="phone-fill" color="#2979ff" size="28"></u-icon>
						</view>
					</view>
				</view>
				<view class="inputRow"  style="width: 50%;">
					<view class="label">
						{{language.veriRegistration.label4}}:
					</view>
					<view class="val" >
						<!-- {{params.startDate ? params.startDate : '请选择' }} -->
						{{detailObj.personId_dictText | emty}}
					</view>
				</view>
				<view class="inputRow" style="width: 50%;">
					<view class="label">
						{{language.veriRegistration.label5}}:
					</view>
					<view class="val" >
						{{detailObj.personCode | emty}}
					</view>
				</view>
				<view class="inputRow" style="width: 50%;">
					<view class="label">
						{{language.veriRegistration.label6}}:
					</view>
					<view class="val" >
						{{detailObj.roomCode ? detailObj.roomCode : ''}}
					</view>
				</view>
				<view class="inputRow" style="width: 50%;">
					<view class="label">
						{{language.veriRegistration.label7}}:
					</view>
					<view class="val" >
						{{detailObj.bedCode ? detailObj.bedCode : ''}}
					</view>
				</view>
				<view class="inputRow">
					<view class="label">
						{{language.veriRegistration.label8}}:
					</view>
					<view class="val" style="flex: 1;" >
						<!-- {{params.startDate ? params.startDate : '请选择' }} -->
						{{detailObj.exceptionTypes_dictText}}
					</view>
				</view>
				<view class="inputRow" @click="selectListShow=true">
						<view class="label">
							{{language.veriRegistration.label9}}:
						</view>
						<view :class="selectLabel ? 'val' : 'emty'" >
							{{selectLabel ? selectLabel : language.veriRegistration.tip }}
						</view>
				</view>
			</view>
			
			
		</view>
		<view class="submitBtn"  @click="handleSubmit">
			{{language.veriRegistration.submit}}
		</view>
		
		
			
	
		<u-datetime-picker
		    :show="startDateShow" ref="datetimePicker" v-model="startDate" 
		    mode="dateTime"  @cancel="startDateShow=false" @confirm="startDateConfirm"
		       ></u-datetime-picker>
		<u-datetime-picker
			:show="endDateShow" ref="datetimePicker" v-model="endDate" 
			mode="dateTime"  @cancel="endDateShow=false" @confirm="endDateConfirm"
	       ></u-datetime-picker>
		<u-picker :show="selectListShow" :columns="selectList" keyName="label" @confirm="selectConfirm"
			@cancel="selectListShow = false"></u-picker>
	</view>
</template>

<script>
	import {dormAccessExceptionRecordConfirmApi} from '@/common/api/commonApi/dormApi.js'
	export default {
		data() {
			return {
				list:[],
				params:{
					createBy: uni.getStorageSync('selectInfoAccount').name,
					createId: uni.getStorageSync('selectInfoAccount').id,
					personId :'',
					startDate : '',
					endDate : '',
					generalClassify: 1,
				},
				startDate: Number(new Date()),
				endDate: Number(new Date()),
				startDateShow : false,
				endDateShow : false,
				total : 0,
				detailObj: {},
				selectList : [
					[
						{
							label : '请假',
							val: 0
						},
						{
							label : '忘打卡',
							val: 1
						},
						{
							label : '忘带卡',
							val: 2
						},
						{
							label : '其它',
							val: 3
						},
						
					]
				],
				selectLabel : '',
				selectListShow: false,
			}
		},
		components:{
		},
		methods: {
			selectConfirm(e){
				this.selectLabel = e.value[0].label
				this.detailObj.cehckResult = e.value[0].val
				this.selectListShow = false
			},
			handleSubmit(){
				if(!this.selectLabel) return this.setMessage('请选择异常考勤原因')
				dormAccessExceptionRecordConfirmApi({
					id: this.detailObj.id,
					cehckResult: this.detailObj.cehckResult,
				}).then(res=>{
						this.setMessage('操作成功')
						this.goBack()
				})
			},
			startDateConfirm(e){
				let date = this.dateformat(e.value)
				this.params.startDate = date
				console.log(this.params.startDate);
				this.startDateShow = false
			},
			endDateConfirm(e){
				let date = this.dateformat(e.value)
				this.params.endDate = date
				this.endDateShow = false
			},
			getList(){
				let params = this.params
				if(!params.endDate) delete params.endDate
				if(!params.startDate) delete params.startDate
				if(!params.transChannl) delete params.transChannl
				acAccessRecordApi(params).then(res=>{
					if(params.currPage==1) this.list = []
					this.list = this.list.concat(res.page.list)
					this.total = res.page.totalCount
				})
			},
			
			
		},
		onLoad() {
			this.setPageTitle(this.language.veriRegistration.title)
			this.detailObj = this.$Route.query.item
			console.log(this.$Route.query.item);
		},
		onShow() {
			
		},
	}
</script>

<style lang="scss" scoped>
.page{
	background-color: #f1f1f1;
	// height: 100vh;
	.searchBox{
		display: flex;
		align-items: center;
		background-color: #fff;
		padding:  20rpx;
		border-bottom: 1px solid #f1f1f1;
		margin: 20rpx;
		border-radius: 8rpx;
		// box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
		.inputBox{
			// flex: 1;
			padding-right: 30rpx;
			display: flex;
			flex-wrap: wrap;
			.inputRow{
				width: 100%;
				border-bottom: 1px solid #f1f1f1;
				min-height: 120rpx;
				display: flex;
				align-items: center;
				font-size: 32rpx;
				padding-left: 20rpx;
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				.label{
					color: #191919;
					margin-right: 30rpx;
				}
			}
			.input{
				
			}
			.emty{
				color: #c0c4cc;
			}
			.val{
				display: flex;
				align-items: center;
			}
			.text{
				margin: 0 20rpx;
			}
		}
		.btnBox{
			display: flex;
			flex-direction: column;
			padding: 10rpx 0;
			.reset{
				margin-top: 20rpx;
				border: 1px solid #f1f1f1;
				background: #fff !important;
				color: #353535 !important;
			}
			.btn{
				padding: 0 30rpx;
				// width: 110rpx;
				height: 60rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				background: #1890ff;
				border-radius: 8rpx;
				color: #fff;
			}
		}
	}
	
	.submitBtn{
		margin: 40rpx;
		// width: 110rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #1890ff;
		border-radius: 8rpx;
		color: #fff;
	}
	
	.boxItem{
			background-color: #fff;
			margin: 20rpx;
			border-radius: 8rpx;
			padding: 10rpx;
			box-shadow: 0px 0px 20rpx 0px rgba(102,102,102,0.15);
			.row{
				margin: 10rpx;
				display: flex;
				.item{
					width: 50%;
					// flex: 1;
				}
				.label{
					color: #969696;
					white-space: nowrap;
				}
				.val{
					color: #353535;
					font-size: 32rpx;
				}
				.btn{
						padding: 0 30rpx;
						width: 120rpx;
						height: 60rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						background: #1890ff;
						border-radius: 8rpx;
						color: #fff;
				}
			}
		}
		
}
</style>
